package com.restaurant.application.indexes.customerlist.support;

import com.nebutown.base.ViewSpec;
import com.nebutown.base.data.ViewUpdate;
import com.nebutown.description.data.UnitForGeneration;
import com.nebutown.generation.PickableBean;
import com.nebutown.generation.basictype.UID;
import com.nebutown.supporthome.AbstractBase;
import com.nebutown.supporthome.CmdCapsule;
import com.restaurant.application.customer.support.CustomerData;
import com.restaurant.application.indexes.customerlist.AssistCustomerListImpl;
import com.restaurant.application.indexes.customerlist.mysql.CustomerListBean;
import com.restaurant.application.indexes.customerlist.mysql.CustomerListCriteria;

public class AssistCustomerListBase extends AbstractBase {
    private UnitForGeneration desc = new UnitForGeneration();

    public AbstractAssistCustomerList getImpl() {
        AbstractAssistCustomerList inst = new AssistCustomerListImpl();
        inst.setBase(this, getEscort());
        return inst;
    }

    @Override
    public AssistCustomerListOutFace getUnitFace() {
        return new AssistCustomerListOutFace(this);
    }

    @Override
    protected Object callDistr(String name, Object... param) {
        switch(name) {
            case "getCustomerUidByOpenId": return getImpl().getCustomerUidByOpenId((String)param[0]);
            case "updateBean": return getImpl().updateBean((UID)param[0], (CustomerData)param[1], (CustomerListBean)param[2]);
            case "createBean":
                return getImpl().createBean((UID) param[0], (CustomerData) param[1]);
            case "getId": return getImpl().getId();
            case "getEffectiveInterface": return getImpl().getEffectiveInterface();
            case "getFullView": setIsRefresher(); return getImpl().getFullView();
            case "getViewLead": return getImpl().getViewLead((ViewSpec)param[0]);
        }
        return null;
    }

    @Override
    protected boolean authDistr(String name) {
        switch(name) {
        }
        return true;
    }

    @Override
    public CmdCapsule getUICall(int cmd) {
        switch(cmd) {
            case 0: return AbstractAssistCustomerList.CMD_SEARCH;
            case 1:
                return AbstractAssistCustomerList.CMD_MODIFY;
        }
        return null;
    }

    @Override
    public ViewUpdate uiCall(int cmd, PickableBean param, int... seq) {
        switch(cmd) {
            case 0: return getImpl().search((CustomerListCriteria)param, seq);
            case 1:
                return getImpl().modify(seq);
        }
        return null;
    }
}
